<!DOCTYPE html>
<html><head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
    <link rel="canonical" href="/unity-vfx/rock-rain/">

    <title>
        
        Rock Rain | h-book
        
    </title>

    
    <link href="/css/fontawesome.min.css" rel="stylesheet">

    
    <link rel="stylesheet" href="/css/ace.min.css">

    

    

</head>
<body><nav class="navbar navbar-expand-lg navbar-dark bg-primary shadow sticky-top" id="navbarMain">
    <div class="container">
        <div>
            <a class="navbar-brand" href="/">
                
                h-book
            </a>
        </div>
    </div>
</nav>
<div class="container-fluid">
            <div class="row">

                <div class="docs-sidenav order-0 col-12 col-md-3 col-lg-2 col-xl-2 position-sticky border-right"><nav class="navbar navbar-expand-md navbar-light pl-0">
    <button class="navbar-toggler navbar-toggler-right collapsed" type="button" data-toggle="collapse" data-target="#sidenav-left-collapse" aria-controls="sidenav-left-collapse" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

     <div class="collapse navbar-collapse align-items-start flex-column" id="sidenav-left-collapse">
            <form class="form-inline my-2 my-lg-0 searchbox">
                <input class="form-control mr-sm-2 w-100" data-search-input id="search-by" type="text" placeholder="Search">
            </form>

        

         <ul class="navbar-nav flex-column pt-3">
    <li data-nav-id="/hugo/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/hugo/"><h6>Hugo</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/hugo/init/" class="nav-item my-1">
                
                
                  <a href="/hugo/init/" class="nav-link p-0">
                    init
                  </a>
                
        </li>
        <li data-nav-id="/hugo/add-page/" class="nav-item my-1">
                
                
                  <a href="/hugo/add-page/" class="nav-link p-0">
                    add-page
                  </a>
                
        </li>
        <li data-nav-id="/hugo/edit-skill/" class="nav-item my-1">
                
                
                  <a href="/hugo/edit-skill/" class="nav-link p-0">
                    edit-skill
                  </a>
                
        </li>
        <li data-nav-id="/hugo/publish/" class="nav-item my-1">
                
                
                  <a href="/hugo/publish/" class="nav-link p-0">
                    publish
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/android/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/android/"><h6>Android</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/android/install/" class="nav-item my-1">
                
                
                  <a href="/android/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/android/create-project/" class="nav-item my-1">
                
                
                  <a href="/android/create-project/" class="nav-link p-0">
                    create project
                  </a>
                
        </li>
        <li data-nav-id="/android/import-material/" class="nav-item my-1">
                
                
                  <a href="/android/import-material/" class="nav-link p-0">
                    import material
                  </a>
                
        </li>
        <li data-nav-id="/android/start-page/" class="nav-item my-1">
                
                
                  <a href="/android/start-page/" class="nav-link p-0">
                    startpage
                  </a>
                
        </li>
        <li data-nav-id="/android/i18n/" class="nav-item my-1">
                
                
                  <a href="/android/i18n/" class="nav-link p-0">
                    i18n
                  </a>
                
        </li>
        <li data-nav-id="/android/nav-flat-page/" class="nav-item my-1">
                
                
                  <a href="/android/nav-flat-page/" class="nav-link p-0">
                    nav flat page
                  </a>
                
        </li>
        <li data-nav-id="/android/activity/" class="nav-item my-1">
                
                
                  <a href="/android/activity/" class="nav-link p-0">
                    Activity
                  </a>
                
        </li>
        <li data-nav-id="/android/db/" class="nav-item my-1">
                
                
                  <a href="/android/db/" class="nav-link p-0">
                    DB
                  </a>
                
        </li>
        <li data-nav-id="/android/dialog/" class="nav-item my-1">
                
                
                  <a href="/android/dialog/" class="nav-link p-0">
                    Dialog
                  </a>
                
        </li>
        <li data-nav-id="/android/fragment/" class="nav-item my-1">
                
                
                  <a href="/android/fragment/" class="nav-link p-0">
                    Fragment
                  </a>
                
        </li>
        <li data-nav-id="/android/jetpack/" class="nav-item my-1">
                
                
                  <a href="/android/jetpack/" class="nav-link p-0">
                    Jetpack
                  </a>
                
        </li>
        <li data-nav-id="/android/material/" class="nav-item my-1">
                
                
                  <a href="/android/material/" class="nav-link p-0">
                    Material
                  </a>
                
        </li>
        <li data-nav-id="/android/storage/" class="nav-item my-1">
                
                
                  <a href="/android/storage/" class="nav-link p-0">
                    Storage
                  </a>
                
        </li>
        <li data-nav-id="/android/%E5%9B%BE%E6%A0%87/" class="nav-item my-1">
                
                
                  <a href="/android/%E5%9B%BE%E6%A0%87/" class="nav-link p-0">
                    图标
                  </a>
                
        </li>
        <li data-nav-id="/android/store/" class="nav-item my-1">
                
                
                  <a href="/android/store/" class="nav-link p-0">
                    Store
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/blender/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/blender/"><h6>Blender</h6></a>
        
    </li>
    <li data-nav-id="/bootstrap/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/bootstrap/"><h6>BootStrap</h6></a>
        
    </li>
    <li data-nav-id="/centos7/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/centos7/"><h6>Centos7</h6></a>
        
    </li>
    <li data-nav-id="/dlna/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/dlna/"><h6>DLNA</h6></a>
        
    </li>
    <li data-nav-id="/docker/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/docker/"><h6>Docker</h6></a>
        
    </li>
    <li data-nav-id="/dubbo/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/dubbo/"><h6>Dubbo</h6></a>
        
    </li>
    <li data-nav-id="/ffmpeg/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/ffmpeg/"><h6>FFmpeg</h6></a>
        
    </li>
    <li data-nav-id="/git/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/git/"><h6>Git</h6></a>
        
    </li>
    <li data-nav-id="/gitbook/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/gitbook/"><h6>Gitbook</h6></a>
        
    </li>
    <li data-nav-id="/gitlab/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/gitlab/"><h6>Gitlab</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/gitlab/runner/" class="nav-item my-1">
                
                
                  <a href="/gitlab/runner/" class="nav-link p-0">
                    Runner
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/gradle/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/gradle/"><h6>Gradle</h6></a>
        
    </li>
    <li data-nav-id="/java/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/java/"><h6>Java</h6></a>
        
    </li>
    <li data-nav-id="/jenkins/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/jenkins/"><h6>Jenkins</h6></a>
        
    </li>
    <li data-nav-id="/kubernetes/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/kubernetes/"><h6>Kubernetes</h6></a>
        
    </li>
    <li data-nav-id="/mybatis/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mybatis/"><h6>Mybatis</h6></a>
        
    </li>
    <li data-nav-id="/mybatis-plus/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mybatis-plus/"><h6>Mybatis Plus</h6></a>
        
    </li>
    <li data-nav-id="/mysql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/mysql/"><h6>MySQL</h6></a>
        
    </li>
    <li data-nav-id="/nodejs/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/nodejs/"><h6>Node.js</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/nodejs/npm/" class="nav-item my-1">
                
                
                  <a href="/nodejs/npm/" class="nav-link p-0">
                    NPM
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/postgresql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/postgresql/"><h6>PostgreSQL</h6></a>
        
    </li>
    <li data-nav-id="/redis/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/redis/"><h6>Redis</h6></a>
        
    </li>
    <li data-nav-id="/samba/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/samba/"><h6>Samba</h6></a>
        
    </li>
    <li data-nav-id="/sql/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/sql/"><h6>SQL</h6></a>
        
    </li>
    <li data-nav-id="/ue5/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/ue5/"><h6>UE5</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/ue5/install/" class="nav-item my-1">
                
                
                  <a href="/ue5/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/ue5/uninstall/" class="nav-item my-1">
                
                
                  <a href="/ue5/uninstall/" class="nav-link p-0">
                    uninstall
                  </a>
                
        </li>
        <li data-nav-id="/ue5/qa/" class="nav-item my-1">
                
                
                  <a href="/ue5/qa/" class="nav-link p-0">
                    Q&amp;A
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity/"><h6>Unity</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity/install/" class="nav-item my-1">
                
                
                  <a href="/unity/install/" class="nav-link p-0">
                    install
                  </a>
                
        </li>
        <li data-nav-id="/unity/scene/" class="nav-item my-1">
                
                
                  <a href="/unity/scene/" class="nav-link p-0">
                    scene
                  </a>
                
        </li>
        <li data-nav-id="/unity/inspector/" class="nav-item my-1">
                
                
                  <a href="/unity/inspector/" class="nav-link p-0">
                    inspector
                  </a>
                
        </li>
        <li data-nav-id="/unity/assets/" class="nav-item my-1">
                
                
                  <a href="/unity/assets/" class="nav-link p-0">
                    assets
                  </a>
                
        </li>
        <li data-nav-id="/unity/audio-source/" class="nav-item my-1">
                
                
                  <a href="/unity/audio-source/" class="nav-link p-0">
                    audio source
                  </a>
                
        </li>
        <li data-nav-id="/unity/camera/" class="nav-item my-1">
                
                
                  <a href="/unity/camera/" class="nav-link p-0">
                    camera
                  </a>
                
        </li>
        <li data-nav-id="/unity/script/" class="nav-item my-1">
                
                
                  <a href="/unity/script/" class="nav-link p-0">
                    script
                  </a>
                
        </li>
        <li data-nav-id="/unity/prefabs/" class="nav-item my-1">
                
                
                  <a href="/unity/prefabs/" class="nav-link p-0">
                    prefabs
                  </a>
                
        </li>
        <li data-nav-id="/unity/physics/" class="nav-item my-1">
                
                
                  <a href="/unity/physics/" class="nav-link p-0">
                    physics
                  </a>
                
        </li>
        <li data-nav-id="/unity/skybox/" class="nav-item my-1">
                
                
                  <a href="/unity/skybox/" class="nav-link p-0">
                    skybox
                  </a>
                
        </li>
        <li data-nav-id="/unity/particle-system/" class="nav-item my-1">
                
                
                  <a href="/unity/particle-system/" class="nav-link p-0">
                    particle system
                  </a>
                
        </li>
        <li data-nav-id="/unity/shortcut-keys/" class="nav-item my-1">
                
                
                  <a href="/unity/shortcut-keys/" class="nav-link p-0">
                    shortcut keys
                  </a>
                
        </li>
        <li data-nav-id="/unity/qa/" class="nav-item my-1">
                
                
                  <a href="/unity/qa/" class="nav-link p-0">
                    Q&amp;A
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-2d-beginner/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-2d-beginner/"><h6>Unity 2D Beginner</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-2d-beginner/init-and-move/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/init-and-move/" class="nav-link p-0">
                    Init &amp; Move
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/map/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/map/" class="nav-link p-0">
                    Map
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/data/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/data/" class="nav-link p-0">
                    Data
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/animate/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/animate/" class="nav-link p-0">
                    Data
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/bullet/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/bullet/" class="nav-link p-0">
                    Bullet
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/cinemachine/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/cinemachine/" class="nav-link p-0">
                    Cinemachine
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/particle/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/particle/" class="nav-link p-0">
                    Particle
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/ui/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/ui/" class="nav-link p-0">
                    UI
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/npc/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/npc/" class="nav-link p-0">
                    NPC
                  </a>
                
        </li>
        <li data-nav-id="/unity-2d-beginner/sound/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-beginner/sound/" class="nav-link p-0">
                    Sound
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-2d-game-kit/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-2d-game-kit/"><h6>Unity 2D Game Kit</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-2d-game-kit/record/" class="nav-item my-1">
                
                
                  <a href="/unity-2d-game-kit/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-3d-beginner/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-3d-beginner/"><h6>Unity 3D Beginner</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-3d-beginner/init/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/level/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/level/" class="nav-link p-0">
                    Level
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/nav/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/nav/" class="nav-link p-0">
                    Nav
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/render-pipeline/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/render-pipeline/" class="nav-link p-0">
                    Render Pipeline
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/postprocessing/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/postprocessing/" class="nav-link p-0">
                    PostProcessing
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/ui/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/ui/" class="nav-link p-0">
                    UI
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/enemy/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/enemy/" class="nav-link p-0">
                    Enemy
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/sound/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/sound/" class="nav-link p-0">
                    Sound
                  </a>
                
        </li>
        <li data-nav-id="/unity-3d-beginner/%E5%BB%BA%E6%A8%A1%E5%B7%A5%E5%85%B7/" class="nav-item my-1">
                
                
                  <a href="/unity-3d-beginner/%E5%BB%BA%E6%A8%A1%E5%B7%A5%E5%85%B7/" class="nav-link p-0">
                    建模工具
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-arpg/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-arpg/"><h6>Unity ARPG</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-arpg/init/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-arpg/role-state-machine/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/role-state-machine/" class="nav-link p-0">
                    Role State Machine
                  </a>
                
        </li>
        <li data-nav-id="/unity-arpg/api-piece/" class="nav-item my-1">
                
                
                  <a href="/unity-arpg/api-piece/" class="nav-link p-0">
                    API Piece
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-animation/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-animation/"><h6>Unity Creativecore Animation</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-animation/door/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-animation/door/" class="nav-link p-0">
                    Door
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-animation/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-animation/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-lighting/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-lighting/"><h6>Unity Creativecore Lighting</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-lighting/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-lighting/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-lighting/outdoor/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-lighting/outdoor/" class="nav-link p-0">
                    Outdoor
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creativecore-shader/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creativecore-shader/"><h6>Unity Creativecore Shader</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creativecore-shader/init/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-shader/glass/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/glass/" class="nav-link p-0">
                    Glass
                  </a>
                
        </li>
        <li data-nav-id="/unity-creativecore-shader/shader-graph/" class="nav-item my-1">
                
                
                  <a href="/unity-creativecore-shader/shader-graph/" class="nav-link p-0">
                    Shader-Graph
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creator-kit-beginner-code/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creator-kit-beginner-code/"><h6>Unity Creator Kit Beginner Code</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creator-kit-beginner-code/record/" class="nav-item my-1">
                
                
                  <a href="/unity-creator-kit-beginner-code/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-creator-kit-fps/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-creator-kit-fps/"><h6>Unity Creator Kit FPS</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-creator-kit-fps/record/" class="nav-item my-1">
                
                
                  <a href="/unity-creator-kit-fps/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-mythirdperson/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-mythirdperson/"><h6>Unity My Third Person</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-mythirdperson/init/" class="nav-item my-1">
                
                
                  <a href="/unity-mythirdperson/init/" class="nav-link p-0">
                    Init
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-playground/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-playground/"><h6>Unity Playground</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-playground/record/" class="nav-item my-1">
                
                
                  <a href="/unity-playground/record/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-ui/" class="nav-item my-1 haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-ui/"><h6>Unity UI</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-ui/init/" class="nav-item my-1">
                
                
                  <a href="/unity-ui/init/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/unity-vfx/" class="nav-item my-1 parent haschildren
        ">
        
        
          <a class="nav-link p-0" href="/unity-vfx/"><h6>Unity VFX</h6></a>
        
        <ul class="list-unstyled ml-2">
        <li data-nav-id="/unity-vfx/init/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/init/" class="nav-link p-0">
                    record
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/bullet/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/bullet/" class="nav-link p-0">
                    bullet
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/rain/" class="nav-item my-1">
                
                
                  <a href="/unity-vfx/rain/" class="nav-link p-0">
                    rain
                  </a>
                
        </li>
        <li data-nav-id="/unity-vfx/rock-rain/" class="nav-item my-1 active">
                
                
                  <a href="/unity-vfx/rock-rain/" class="nav-link p-0">
                    Rock Rain
                  </a>
                
        </li>
        </ul>
    </li>
    <li data-nav-id="/vue/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/vue/"><h6>Vue</h6></a>
        
    </li>
    <li data-nav-id="/web/" class="nav-item my-1
        ">
        
        
          <a class="nav-link p-0" href="/web/"><h6>Web</h6></a>
        
    </li>
        </ul>
    </div>
</nav>


</div>
                <div class="docs-toc large order-lg-2 order-md-0 order-xs-1 col-12 col-lg-2 col-xl-2 position-sticky border-left"><div class="docs-toc">
	<nav id="TableOfContents">
  <ul>
    <li><a href="#陨石雨">陨石雨</a>
      <ul>
        <li><a href="#用代码控制">用代码控制</a></li>
        <li><a href="#cpu-event-和-gpu-event">CPU Event 和 GPU Event</a></li>
      </ul>
    </li>
  </ul>
</nav>
</div>
</div>
                <div class="main col-12 order-1 col-md-9 col-lg-10 col-xl-8 py-3">
                

<div class="d-flex flex-column">
    <h1 class="js-title">Rock Rain</h1>
    <div class="d-flex align-items-center">
        
    </div>
</div>

<hr>


<p>2024.09.23</p>
<h2 id="陨石雨">陨石雨</h2>
<ol>
<li>Hierarchy -&gt; Visual Effects -&gt; Visual Effect ，改名为 RockRainVFX</li>
<li>Instantiate -&gt; VisualEffect -&gt; New ，存放到 Assets/VFXs/RockRain.vfx</li>
<li>Instantiate -&gt; Visual Effect -&gt; RockRain -&gt; Edit</li>
</ol>
<p>在 Visual Effect Graph 中</p>
<ol>
<li>选中 Spawn system ，在 Inspector 中修改 Loop Duration 和 Loop Count 为 Constant ，然后在 Graph 把 Loop Duration 改为 1 （秒）</li>
<li>Graph 中添加 int 类型的 Rate 变量， 将其拖出来和 Spawn system 的 Rate 连接起来。这样可以在 Inspector 中修改 Rate 的值。另外显示粒子的数量还受 Initialize Particle 中的 Capacity 控制</li>
<li>Initialize Particle 中的 Bounds Mode 改为 Automatic 的话，会根据粒子的范围自动调整；改为 Rocorded 的话，就需要在配置完后，通过 VFX Control 面板中的 Bounds Recording 按钮录制范围。</li>
<li>在 Initialize Particle 中添加 Set Position Arc Cone 。将 Height Mode 改为 Base 。 Position Mode 改为 Volume 。把 Position 和新建的 Vector3 类型的 InitPosition 连接起来，并把 Y 改为 10 。把 Base Radius 和 Top Radius 与新建的 float 类型的 InitRadius 连接起来，并改为 5 。新建 Vector3 类型的 InitDirection ，设置为 0 -25 10 ，与 Set Velocity Random (Per-component) 的 B 相连，然后再与 Multiply 的 A 连接， B 改为 0.8 ，将 Multiply 的结果和 Set Velocity Random (Per-component) 的 A 相连。新建 float 类型的 InitLifeTime ，值为 3 ，和 Set Lifetime Random (Uniform) 的 A B 相连，可以选择性的把这个节点的 Random 从 Uniform 改为 Off。</li>
<li>删掉 Output Particle Quad 。在 Update Particle 中添加 Trigger Event Rate(Over Time)，如果没有这个，则需要在 Preferences -&gt; Visual Effects -&gt; Experimental Operators/Blocks 打勾。然后把这个节点的 Mode 改为 Over Distance 。然后把 evt 连接到新建的 GPUEvent 节点</li>
</ol>
<ul>
<li>选择OverTime 表示平均每秒钟发送几次事件， Rate 表示 ：次/秒</li>
<li>选择OverDistance 表示每运动距离一米发送几次事件， Rate 表示：次/米</li>
</ul>
<ol start="6">
<li>新建 Simple Particle System ，把 Spawn 节点删掉，把 Initialize Particle 的 Date Type 改为 Particle Strip 。让 GPUEvent 和 Initialize Particle Strip 连接</li>
<li>修改 Initialize Particle Strip 的 Strip Capacity 为 1000 ， Particle Per Strip Count 为 100 ， Bounds Mode 为 Automatic 。添加 Inherit Source Position (Set) 并放在最前面，删掉 Set Velocity Random (Per-component) 。把 Set Lifetime 的 Random 改为 Off ，新增一个 float 类型的 SubLifeTime 和 Lifetime 相连，值为 0.4</li>
<li>把 Output Particle Quad 删掉，新建 Output ParticleStrip Quad 与 Update Particle Strip 相连。新建 Texture2D 类型的 SubTexture ， Value 使用 Assets/Textures/Trail03-r.png ，让后和 Output ParticleStrip Quad 的 Main Texture 相连</li>
<li>Output ParticleStrip Quad 新增 Orient Face Camera Position ，新增 Set Size 再和新增的 float 属性的 SubSize 相连，值为 0.8 ，新增 Multiply Size over Life 并把曲线改为从 0, 1 到 1, 0 。新增 Set Color over Life ，把颜色改成红黄色</li>
<li>复制一份从 GPUEvent 到 Output ParticleStrip Quad ，从 Update Particle 的 evt 新连接到这个 GPUEvent ，复用 SubTexture ，把 SubSize 和 SubLifeTime 做一个 Mutiply 后复用 ，最后把颜色改改，实现内外两层，一大一小，不同颜色的效果</li>
<li>给 Update Particle 添加 Collide with Plane (VFX的碰撞一般不与模型交互，而是自带的模型，如这个Plane，所以把这个Plane和模型相重叠即可)。把 Lifetime Loss 改为 1</li>
<li>给 Update Particle 添加 Trigger Event On Die ，把 Count 改为 10 。然后把 evt 和新建的 Simple Particle System 的 Initialize Particle 相连(删掉 Spawn)</li>
<li>Initialize Particle 的 Capatity 改为 100 ， Bounds Mode 改为 Automatic 。开头插入 Inherit Source Position (Set) 。修改 Set Velocity Random (Per-component) 的 A B 为 5 2 5 ， -5 7 -5 。修改 Set Lifetime Random (Uniform) 的 A B 为 0.3 0.8 。</li>
<li>在 Update Particle 中添加 Gravity ，把 Force 的 Y 拉出来和一个 Random Number 相连接，Random Number 的 Min 和 Max 设置为 0 10</li>
<li>Output ParticleStrip Quad 的 Main Texture 改为 Default-Particle 。删掉 Orient Face Camera Plane ，新增 Orient Along Velocity ，再后面加一个 Set Size Random (Uniform) ，把 A B 设置为 0.8 1.2 。把 Set Size over Life 的 Composition 改为 Multiply ， Size 曲线改为 0 1 到 1 0 。再后面加一个 Set Scale Random (Per-component)，把 A B 设置为 0.1 0.5 1 , 0.3 1 1</li>
<li>Set Color over Life 的 Color 设置为之前用的颜色</li>
<li>同前面添加 Trigger Event On Die 的地方，再追加一个 Trigger Event On Die ，Count 为 1 .再和 GPUEvent 相连，再和 Initialize Particle 相连，Capacity 为 128 ， Bounds Mode 为 Automatic 。添加 Inherit Source Position (Set) 。添加 Set Lifetime Random (Uniform) ，A B 为 0.1 0.3</li>
<li>Initialize Particle 连接 Update Particle 。再把 Update Particle 和 Output ParticleStrip Quad 连接。</li>
<li>Output ParticleStrip Quad 的 Main Texture 设置为 Default-Particle 。添加 Orient Face Camera Plane 。添加 Set Size Random (Uniform) ，A B 设置为 4 6 。添加 Multiply Size over Life ，曲线改为 0 1 , 1 0 。添加 Set Color ，把 Color 设置为相近的颜色 。添加 Multiply Color over Life ，透明度 10% 255 ，100% 0</li>
<li>同样位置再添加 Trigger Event On Die ，Count 为 2 ，连接 GPUEvent ，连接 Initialize Particle ，Capacity 为 128 ， Bounds Mode 为 Automatic 。添加 Inherit Source Position (Set) 。添加 Set Lifetime ，设置 Lifetime 为 0.15 。添加 Set Angle 。外面添加 Get Attribute spawnIndex 连接 Compare ，把 Condition 改为 Greater ，再连接 Branch ，把 True 值设为 45 ，False 值设为 135 ，将 Branch 和 Set Angle 的 Z 连接起来。实现两个粒子旋转角度，成十字状</li>
<li>Initialize Particle 连接 Update Particle ，Update Particle 连接 Output ParticleStrip Quad ，Main Texture 设置为 Default-Particle ，添加 Orient Face Camera Plane 。添加 Set Size Random (Uniform) ，A B 设置为 4 6 。添加 Multiply Size over Life ，曲线改为 0 1 , 1 0 。添加 Set Scale ，把 X 改为 0.15 。添加 Set Color ，把 Color 设置为相近的颜色 。添加 Multiply Color over Life ，透明度 10% 255 ，100% 0 。</li>
</ol>
<p>注1：当把 Output ParticleStrip Quad 连接时会出现 <code>There are more uavs (9) than the maximum supported (8) in ComputeShader '[RockRain] [System] Update Particle' kernel 'CSMain'.</code> 报错。暂没找到解决办法，临时把上一个 GPUEvent 断开。</p>
<p>注2：找到一个方法，但仍然会报错，只是会正常显示。具体为 Edit -&gt; Project Settings -&gt; Player -&gt; Other Settings -&gt; Auto Graphics API for Windows 勾去掉，点加号选择 Direct3D12 ，再把 11 删掉，重启 unity</p>
<p>注3：找到另一个方法，就是在之前的一个系统中的 Update Particle 添加 Trigger Event Always （不一定是 Always ，也可以是 On Die ），设置 Count 。也就是不在第一个系统中创建子系统</p>
<ol start="22">
<li>按照教程，如果多个特效叠加可能会出现被遮挡的问题。可以在点击 Assets/VFXs/RockRain.vfx 后，于 Inspector 中找到 Output Render Order 面板，把里面的顺序调整一下</li>
<li>在18步的 Update Particle 中添加 Trigger Event Always ，Count 为 1 。同理创建 GPUEvent 、Initialize Particle 、Update Particle。</li>
<li>Initialize Particle 的Bounds Mode 设置为 Automatic 。删除 Set Velocity Random (Per-component)。修改 Set Lifetime Random(Uniform) 为 0.5 1 。添加 Inherit Source Position (Set) ，修改 X 为90</li>
<li>Output Particle Quad 的 Main Texture 设置为 Default-Particle 。删除 Orient Face Camera Plane 。首位添加 Set Size Random (Uniform) ，A B 设置为 0.5 1 。 Set Size over Life 的 Curve 改为 0 1 到 1 0 。修改颜色为近似的色</li>
<li>同样再来一份，Initialize Particle 只要 Inherit Source Position (Set) 、 Set Angle Random (Uniform) Channels Z A B 0 360、 Set TexasIndex Random (Uniform) A B 0 63 、Set Size Random (Uniform) A B 10 13和 Set Lifetime Random(Uniform) A B 0.2 0.3 。Output Particle Quad 的 Main Texture 设置为 Assets/Textures/WispySmoke01_8x8.tga ， Uv Mode 改为 Flipbook Blend ， Flip Book Size 为 8 8 。 Update Particle 添加 Flipbook Player ， Frame Rate 改为 30 。追加 Gravity ， Force Y 设置为 5 。 Output Particle Quad 的 Set Size over Life 曲线改为 0 1 到 1 3.5</li>
<li>根上找到 Spawn system ，在输出上额外连接一个 Output Event ，Event Name 按需修改</li>
</ol>
<h3 id="用代码控制">用代码控制</h3>
<ol>
<li>将根的 Spawn system 中的 Loop Count 改为 Constant (Inspector中)和 0 (Visual Effect Graph中)</li>
<li>关键代码</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cs" data-lang="cs"><span style="display:flex;"><span><span style="color:#00a8c8">using</span> <span style="color:#111">UnityEngine.VFX</span><span style="color:#111">;</span> <span style="color:#75715e">// 导命名空间</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">public</span> <span style="color:#111">VisualEffect</span> <span style="color:#111">vfx</span><span style="color:#111">;</span> <span style="color:#75715e">// 暴露赋值</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">void</span> <span style="color:#111">Start</span><span style="color:#111">()</span>
</span></span><span style="display:flex;"><span><span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>  <span style="color:#00a8c8">if</span> <span style="color:#111">(</span><span style="color:#111">vfx</span> <span style="color:#111">==</span> <span style="color:#00a8c8">null</span><span style="color:#111">)</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">return</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">vfx</span><span style="color:#111">.</span><span style="color:#111">Stop</span><span style="color:#111">();</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">vfx</span><span style="color:#111">.</span><span style="color:#111">SetInt</span><span style="color:#111">(</span><span style="color:#d88200">&#34;Rate&#34;</span><span style="color:#111">,</span> <span style="color:#ae81ff">10</span><span style="color:#111">);</span> <span style="color:#75715e">// 设置参数</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">void</span> <span style="color:#111">Update</span><span style="color:#111">()</span>
</span></span><span style="display:flex;"><span><span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>  <span style="color:#00a8c8">if</span> <span style="color:#111">(</span><span style="color:#111">Input</span><span style="color:#111">.</span><span style="color:#111">GetMouseButtonDown</span><span style="color:#111">(</span><span style="color:#ae81ff">1</span><span style="color:#111">))</span> <span style="color:#111">{</span> <span style="color:#75715e">// 右键触发</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">vfx</span><span style="color:#111">.</span><span style="color:#111">Play</span><span style="color:#111">();</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div><ol start="3">
<li>在 RockRainVFX 对象上添加一个脚本，接收 Output Event</li>
</ol>
<div class="highlight"><pre tabindex="0" style="color:#272822;background-color:#fafafa;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-cs" data-lang="cs"><span style="display:flex;"><span><span style="color:#00a8c8">using</span> <span style="color:#111">UnityEngine.VFX.Utility</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">using</span> <span style="color:#111">UnityEngine.VFX</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span><span style="color:#75af00">
</span></span></span><span style="display:flex;"><span><span style="color:#75af00">[RequireComponent(typeof(VisualEffect))]</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e">// 一个特效中包含多个陨石，需要播放对应的音频（多个音频先后播放）</span>
</span></span><span style="display:flex;"><span><span style="color:#00a8c8">class</span> <span style="color:#75af00">VFXOutputEventPlayMultiAudo</span><span style="color:#111">:</span> <span style="color:#111">VFXOutputEventAbstracthandler</span> <span style="color:#75715e">// 会自带一个暴露的 OutputEvent 属性</span>
</span></span><span style="display:flex;"><span><span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>  <span style="color:#00a8c8">public</span> <span style="color:#00a8c8">override</span> <span style="color:#00a8c8">bool</span> <span style="color:#111">canExecuteInEditor</span> <span style="color:#111">=&gt;</span> <span style="color:#00a8c8">false</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#00a8c8">public</span> <span style="color:#111">AudioClip</span> <span style="color:#111">audioClip</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>  <span style="color:#00a8c8">public</span> <span style="color:#00a8c8">override</span> <span style="color:#00a8c8">void</span> <span style="color:#111">OnVFXOutputEvent</span><span style="color:#111">(</span><span style="color:#111">VisualEventAttr</span> <span style="color:#111">eventAttr</span><span style="color:#111">)</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">GameObject</span> <span style="color:#111">gameObject</span> <span style="color:#111">=</span> <span style="color:#111">GameObject</span><span style="color:#111">.</span><span style="color:#111">Find</span><span style="color:#111">(</span><span style="color:#d88200">&#34;RockRainVFX&#34;</span><span style="color:#111">);</span>
</span></span><span style="display:flex;"><span>    <span style="color:#00a8c8">if</span> <span style="color:#111">(</span><span style="color:#111">gameObject</span> <span style="color:#111">!=</span> <span style="color:#00a8c8">null</span><span style="color:#111">)</span> <span style="color:#111">{</span>
</span></span><span style="display:flex;"><span>      <span style="color:#111">AudioSource</span> <span style="color:#111">audioSource</span> <span style="color:#111">=</span> <span style="color:#111">gameObject</span><span style="color:#111">.</span><span style="color:#111">GetComponent</span><span style="color:#111">&lt;</span><span style="color:#111">AudioSource</span><span style="color:#111">&gt;();</span>
</span></span><span style="display:flex;"><span>      <span style="color:#111">audioSource</span><span style="color:#111">.</span><span style="color:#111">clip</span> <span style="color:#111">=</span> <span style="color:#111">audioClip</span><span style="color:#111">;</span>
</span></span><span style="display:flex;"><span>      <span style="color:#111">audioSource</span><span style="color:#111">.</span><span style="color:#111">Play</span><span style="color:#111">();</span>
</span></span><span style="display:flex;"><span>      <span style="color:#111">Destroy</span><span style="color:#111">(</span><span style="color:#111">audioSource</span><span style="color:#111">,</span> <span style="color:#ae81ff">1.0f</span><span style="color:#111">);</span> <span style="color:#75715e">// 1S后销毁，这里根据实际音频长短修改。或者获取音频长度再来设置</span>
</span></span><span style="display:flex;"><span>    <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span>  <span style="color:#111">}</span>
</span></span><span style="display:flex;"><span><span style="color:#111">}</span>
</span></span></code></pre></div><h3 id="cpu-event-和-gpu-event">CPU Event 和 GPU Event</h3>
<ol>
<li>GPU 产生的碰撞事件并不能和 CPU 相通</li>
<li>再 Spawn 节点上的 Start 和 Stop 可以和 Event 节点相连接+ SpawnEvent 和 Output Event 连接，这个是 GPU 和 CPU 事件的交互点桥梁</li>
</ol>


    


                    
                    <div class="row"></div> 

                </div>

            </div> 

        </div> 
<script src="/lib/jquery.min.js"></script> 
<script src="/lib/popper.min.js"></script> 

<script src="/js/bootstrap.min.js"></script> 


<script type="text/javascript" src="/plugins/lunr.min.js"></script>
<script type="text/javascript" src="/plugins/auto-complete.js"></script>
<link href="/plugins/auto-complete.css" rel="stylesheet">
<script type="text/javascript">
  
      var baseurl = "\/";
  
</script>
<script type="text/javascript" src="/plugins/search.js"></script>

<script type="text/javascript" src="/plugins/favorites.js"></script>


<script type="text/javascript" src="/plugins/clipboard.js"></script>
<script>
  new ClipboardJS('.btn');
</script>
</body>
</html>
